<?xml version="1.0" encoding="gb2312"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:map="maps.uri" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:mysoft="http://www.mysoft.com.cn/" version="1.0">
  <msxsl:script implements-prefix="mysoft" language="c#"><![CDATA[
		string getvalue(string atrname,string  atrvalue, string xml) 
		{
			string find="<AttributeName>"+atrname+"</AttributeName><AttributeValue>"+atrvalue+"</AttributeValue><value>";
			int bgn,ed;
			bgn=xml.IndexOf (find);
			if(bgn>0)
			{
				ed=xml.IndexOf ("</value>",bgn);
				return xml.Substring (bgn+find.Length ,ed-bgn-find.Length );
			}
			else
				return "";
		}
    ]]></msxsl:script>
  <xsl:param name="str" />
  <xsl:template match="/resultset">
    <xsl:element name="resultset">
      <xsl:attribute name="morerecords">
        <xsl:value-of select="@morerecords" />
      </xsl:attribute>
      <xsl:apply-templates select="*" />
    </xsl:element>
  </xsl:template>
  <xsl:template match="result">
    <xsl:element name="result">
      <xsl:for-each select="*">
        <xsl:variable name="atrname" select="name()" />
        <xsl:variable name="atrvalue" select="text()" />
        <xsl:element name="{name()}">
          <xsl:for-each select="@*">
            <xsl:attribute name="{name()}">
              <xsl:value-of select="." />
            </xsl:attribute>
          </xsl:for-each>
          <xsl:if test="mysoft:getvalue($atrname,$atrvalue,$str)!=&quot;&quot;">
            <xsl:attribute name="name">
              <xsl:value-of select="mysoft:getvalue($atrname,$atrvalue,$str)" />
            </xsl:attribute>
          </xsl:if>
          <xsl:value-of select="$atrvalue" />
        </xsl:element>
      </xsl:for-each>
    </xsl:element>
  </xsl:template>
</xsl:stylesheet>